package gen.desktop;

import gen.desktop.sqlite.Client;

import java.awt.EventQueue;

import javax.swing.JFrame;
import javax.swing.UIManager;

public class Application {
	private static String OWNER = "self";
	private static String REPOSITORY = "repository.s3db";
	private static Client sqliteClient = new Client();
	private static MainFrame mainFrame;
	
	public static Client getSqliteClient(){
		return sqliteClient;
	}
	
	public static String getOwner(){
		return OWNER;
	}
	
	public static String getRepository(){
		return REPOSITORY;
	}
	
	public static MainFrame getMainFrame(){
		return mainFrame;
	}
	
	public static void Launch(){
		if(mainFrame != null){
			return;
		}
		
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
					MainFrame frame = new MainFrame();
					frame.setVisible(true);
					frame.genByArraysPanel.init();
					frame.genBySqlPanel.init();
					frame.setExtendedState(JFrame.MAXIMIZED_BOTH);
					
					mainFrame = frame;
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}
}
